package sk.isomi.minihr.entities;

import java.util.ArrayList;

public class Client extends Person {
	private ArrayList<Project> projects;
	
	public Client(String id, String prefix, String name, String surname, String birthNumber) {
		super(id, prefix, name, surname, birthNumber);
		projects = new ArrayList<Project>();
	}

	public Client(String id, String surname, String birthNumber) {
		super(id, surname, birthNumber);
		projects = new ArrayList<Project>();
	}

	@Override
	protected boolean validateId(String id) throws RuntimeException {
		return id != null && id.matches("C\\d{2}");
	}
	
	
	
	public ArrayList<Project> getProjects() {
		return projects;
	}

	public void setProjects(ArrayList<Project> projects) {
		this.projects = projects;
	}
	@Override
	public boolean equals(Object obj) {
		return obj != null && obj instanceof Client && ((Client) obj).getId().equalsIgnoreCase(getId());
	}
	
	@Override
	public String toString() {
		return String.format("Client [projects=%s, getName()=%s, getSurname()=%s, getId()=%s]",	projects, getName(), getSurname(), getId());
	}
}
